$(document).ready(function () {
    //打开页面的时候执行



    var currentPage = 1;
// 4.调用插件
    var box = new CustomPagination('#page', {
        total: 3,//总页数
        changePage: function (pageNum) {//切换页码成功回调


            if (pageNum!=currentPage) {
                $.ajax({
                    type: "GET",
                    url: "/changePage?pageNum="+pageNum,
                    // data: pageNum,
                    contentType:'application/json',
                    dataType: "json",
                    success: function(data){

                        var area = $("#area");
                        area.empty();
                        // area.append("<h1>nimade</h1>");

                        $.each(data, function (n, value) {

                            var tr =
                                "<div><article class='am-g blog-entry-article'>" +
                                "<div class='am-u-lg-6 am-u-md-12 am-u-sm-12 blog-entry-text'>" +
                                "<span class='blog-color' style='font-size: 15px;'><a>默认分类</a></span>" +
                                "<span>&nbsp;&nbsp;&nbsp;</span>" +
                                "<span style='font-size: 15px;'>发布于 "+value.created+"</span>"+
                                "<h2><a style='color: #0f9ae0; font-size: 20px;'>"+value.title+"</a></div></h2>" +
                                "<div style='font-size: 16px;'>"+value.content+"</div>";
                                "</div>" +
                                "</article></div>";


                            area.append(tr);

                        });


                    }
                });
            }

            currentPage=pageNum;
            console.log('当前页码：'+pageNum);

        }
    });
// }
});

